package com.example.classes;

import java.io.Serializable;
import java.util.*;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.os.Environment;
import com.google.gson.annotations.Expose;

/**
 * @author      Alexander Huynh <a.huynh @ gatech.edu>
 * @version     1.0
 * @since       2013-02-28
 */
public class Item implements Serializable
{
    @Expose
	public final String name;
    @Expose
	public final String description;
    @Expose
	public final String category;
    @Expose
	public final Location location;
    @Expose
	public 	     boolean state;
    @Expose
	public final boolean lookingFor;
    @Expose
	public		 double reward;
    @Expose
	public final Date date;
    @Expose
	public 	     Bitmap picture;
    @Expose
	public final Member owner;

	/**
	* Constructor
	* Instantiates and sets values.
	* @param name			name of Item
	* @param description	description of Item
	* @param category		category of Item; uses an enum
	* @param location		location of item; uses Location class
	* @param lookingFor		true if being looked for, false if found
	* @param reward			reward for finding Item in USD
	* @param date			date this Item was created
	* @param iconPath		path to	an image of the Item
	* @param member			owner of the Item
	*/
    public Item(String name, String description, String category, Location location,
    			boolean lookingFor, double reward, Date date, String iconPath, Member member)
    {
        String Filepath= Environment.getExternalStorageDirectory()+iconPath;
		this.name = name;
		this.description = description;
		this.category = category;
		this.location = location;
		state = false;
		this.lookingFor = lookingFor;
		this.reward = reward;
		this.date = date;
		this.picture = BitmapFactory.decodeFile(Filepath);
		this.owner = member;
    }

    @Override
    public String toString() {
        return "Item{" +
                "name='" + name + '\'' +
                '}';
    }
}